Skip to content

This PR is to add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go#5785

Open
ZzzRemake wants to merge 1 commit intofluid-cloudnative:masterfrom
ZzzRemake:ZzzRemake-comment
Open

This PR is to add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go#5785
ZzzRemake wants to merge 1 commit intofluid-cloudnative:masterfrom
ZzzRemake:ZzzRemake-comment

Conversation

@ZzzRemake
Copy link
Copy Markdown

Ⅰ. Describe what this PR does

This PR is to add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go.

Ⅱ. Does this pull request fix one issue?

fixes #5784

Ⅲ. Special notes for reviews

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot bot commented Apr 10, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ronggu for approval by writing /assign @ronggu in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot bot commented Apr 10, 2026

Hi @ZzzRemake. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds documentation comments to the TestSyncMetadataInternal function in pkg/ddc/efc/metadata_test.go to outline the various test scenarios covered. The reviewer suggests refactoring the test suite to utilize Go subtests (t.Run) for improved readability and more granular failure reporting.

Comment on lines +32 to +36
// TestSyncMetadataInternal tests the syncMetadataInternal method of EFCEngine.
// It verifies the method's behavior under different scenarios:
// 1. When TotalStorageBytes returns an error
// 2. When TotalFileNums returns an error
// 3. When both TotalStorageBytes and TotalFileNums succeed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This comment accurately describes the different scenarios this test covers. To improve the test's structure, readability, and maintainability, consider refactoring it to use subtests with t.Run for each scenario. This provides clearer output on failures and makes the test structure more explicit.

For example:

func TestSyncMetadataInternal(t *testing.T) {
    // ... setup ...

    t.Run("TotalStorageBytes returns an error", func(t *testing.T) {
        // ... test logic for this case ...
    })

    t.Run("TotalFileNums returns an error", func(t *testing.T) {
        // ... test logic for this case ...
    })

    t.Run("Both succeed", func(t *testing.T) {
        // ... test logic for this case ...
    })
}

@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented Apr 16, 2026

The DCO check is failing on this PR. Please ensure your commit includes a Signed-off-by: line matching your Git author info. You can fix this by running git commit --amend -s and force-pushing the branch.

….go.

Signed-off-by: ZzzRemake <remake114514@outlook.com>
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go.

2 participants